```html
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Spring框架核心注解解析</title>
    <link rel="stylesheet" href="https://cdn.staticfile.org/font-awesome/6.4.0/css/all.min.css">
    <link rel="stylesheet" href="https://cdn.staticfile.org/tailwindcss/2.2.19/tailwind.min.css">
    <link href="https://fonts.googleapis.com/css2?family=Noto+Serif+SC:wght@400;500;600;700&family=Noto+Sans+SC:wght@300;400;500;700&display=swap" rel="stylesheet">
    <script src="https://cdn.jsdelivr.net/npm/mermaid@latest/dist/mermaid.min.js"></script>
    <style>
        body {
            font-family: 'Noto Sans SC', Tahoma, Arial, Roboto, "Droid Sans", "Helvetica Neue", "Droid Sans Fallback", "Heiti SC", "Hiragino Sans GB", Simsun, sans-serif;
            color: #333;
            line-height: 1.6;
        }
        .hero {
            background: linear-gradient(135deg, #6e8efb 0%, #a777e3 100%);
        }
        .heading-serif {
            font-family: 'Noto Serif SC', serif;
        }
        .code-block {
            background-color: #f8f9fa;
            border-radius: 6px;
            overflow-x: auto;
        }
        .card-hover:hover {
            transform: translateY(-5px);
            box-shadow: 0 10px 25px rgba(0,0,0,0.1);
        }
        .feature-icon {
            width: 48px;
            height: 48px;
            display: flex;
            align-items: center;
            justify-content: center;
            border-radius: 12px;
        }
        .comparison-table {
            border-collapse: separate;
            border-spacing: 0;
        }
        .comparison-table thead th {
            position: sticky;
            top: 0;
            background-color: white;
            box-shadow: 0 2px 0 #e5e7eb;
        }
        .comparison-table tbody tr:hover {
            background-color: #f9fafb;
        }
        .footer {
            background-color: #1a1a1a;
        }
        .mermaid {
            background-color: white;
            padding: 1.5rem;
            border-radius: 0.5rem;
            box-shadow: 0 4px 6px rgba(0,0,0,0.05);
        }
    </style>
</head>
<body class="bg-gray-50">
    <!-- Hero Section -->
    <section class="hero text-white py-20 px-4 md:px-0">
        <div class="container mx-auto max-w-5xl text-center">
            <div class="inline-block bg-white bg-opacity-20 rounded-full px-6 py-2 mb-6">
                <span class="uppercase tracking-wider text-sm font-medium">Spring Framework</span>
            </div>
            <h1 class="heading-serif text-4xl md:text-5xl font-bold leading-tight mb-6">
                Spring核心注解深度解析
            </h1>
            <p class="text-xl md:text-2xl opacity-90 max-w-3xl mx-auto leading-relaxed">
                探索@Bean、@Component和@Configuration注解的精妙差异与应用场景
            </p>
        </div>
    </section>

    <!-- Main Content -->
    <main class="container mx-auto max-w-5xl py-12 px-4 md:px-0">
        <!-- Introduction -->
        <section class="mb-16">
            <p class="text-lg text-gray-700 leading-relaxed mb-8">
                在Spring框架中，注解是配置应用程序的核心方式之一。<code class="bg-gray-100 px-2 py-1 rounded text-pink-600">@Bean</code>、<code class="bg-gray-100 px-2 py-1 rounded text-pink-600">@Component</code>和<code class="bg-gray-100 px-2 py-1 rounded text-pink-600">@Configuration</code>是最常用的三种注解，它们虽然都可以用于注册Bean，但在使用方式和适用场景上有着重要区别。
            </p>
            
            <!-- Key Features -->
            <div class="grid md:grid-cols-3 gap-8 mb-12">
                <div class="bg-white p-6 rounded-xl shadow-md card-hover transition-all duration-300">
                    <div class="feature-icon bg-blue-100 text-blue-600 mb-4">
                        <i class="fas fa-cube text-xl"></i>
                    </div>
                    <h3 class="text-xl font-bold mb-3">@Bean</h3>
                    <p class="text-gray-600">显式声明Bean的创建过程，开发者完全控制实例化逻辑</p>
                </div>
                <div class="bg-white p-6 rounded-xl shadow-md card-hover transition-all duration-300">
                    <div class="feature-icon bg-purple-100 text-purple-600 mb-4">
                        <i class="fas fa-search text-xl"></i>
                    </div>
                    <h3 class="text-xl font-bold mb-3">@Component</h3>
                    <p class="text-gray-600">组件扫描自动注册，由容器管理生命周期</p>
                </div>
                <div class="bg-white p-6 rounded-xl shadow-md card-hover transition-all duration-300">
                    <div class="feature-icon bg-green-100 text-green-600 mb-4">
                        <i class="fas fa-cogs text-xl"></i>
                    </div>
                    <h3 class="text-xl font-bold mb-3">@Configuration</h3>
                    <p class="text-gray-600">声明配置类，替代XML配置方式</p>
                </div>
            </div>
        </section>

        <!-- Detailed Explanation -->
        <section class="mb-16">
            <h2 class="heading-serif text-3xl font-bold mb-8 border-b pb-2">注解详解</h2>
            
            <!-- @Bean -->
            <div class="mb-12">
                <div class="flex items-center mb-4">
                    <span class="bg-blue-600 text-white text-lg font-bold px-4 py-2 rounded-full mr-4">1</span>
                    <h3 class="text-2xl font-bold text-gray-800">@Bean 注解</h3>
                </div>
                <div class="pl-16">
                    <p class="text-gray-700 mb-4">
                        <code class="bg-gray-100 px-2 py-1 rounded text-pink-600">@Bean</code>注解用于在配置类中声明Bean对象。当你需要完全控制Bean的创建过程时，应该使用此注解。
                    </p>
                    <div class="bg-gray-50 p-4 rounded-lg border-l-4 border-blue-500 mb-4">
                        <h4 class="font-bold text-gray-800 mb-2 flex items-center">
                            <i class="fas fa-info-circle text-blue-500 mr-2"></i>关键特性
                        </h4>
                        <ul class="list-disc pl-5 text-gray-700 space-y-2">
                            <li>开发者手动控制Bean的实例化和初始化</li>
                            <li>适用于第三方库的Bean注册</li>
                            <li>方法级别的注解</li>
                            <li>Spring不负责其生命周期管理</li>
                        </ul>
                    </div>
                    <div class="code-block p-4 mb-4">
                        <pre class="text-sm text-gray-800"><code>@Bean
public DataSource dataSource() {
    DataSourceBuilder builder = DataSourceBuilder.create();
    builder.url("jdbc:mysql://localhost:3306/mydb");
    builder.username("admin");
    builder.password("password");
    return builder.build();
}</code></pre>
                    </div>
                </div>
            </div>
            
            <!-- @Component -->
            <div class="mb-12">
                <div class="flex items-center mb-4">
                    <span class="bg-purple-600 text-white text-lg font-bold px-4 py-2 rounded-full mr-4">2</span>
                    <h3 class="text-2xl font-bold text-gray-800">@Component 注解</h3>
                </div>
                <div class="pl-16">
                    <p class="text-gray-700 mb-4">
                        <code class="bg-gray-100 px-2 py-1 rounded text-pink-600">@Component</code>是通用的组件扫描注解，用于标记一个类为Spring管理的组件。
                    </p>
                    <div class="bg-gray-50 p-4 rounded-lg border-l-4 border-purple-500 mb-4">
                        <h4 class="font-bold text-gray-800 mb-2 flex items-center">
                            <i class="fas fa-info-circle text-purple-500 mr-2"></i>关键特性
                        </h4>
                        <ul class="list-disc pl-5 text-gray-700 space-y-2">
                            <li>类级别的注解</li>
                            <li>通过组件扫描自动注册</li>
                            <li>Spring容器负责完整的生命周期管理</li>
                            <li>是<code class="bg-gray-100 px-1 py-0.5 rounded text-sm">@Service</code>, <code class="bg-gray-100 px-1 py-0.5 rounded text-sm">@Repository</code>, <code class="bg-gray-100 px-1 py-0.5 rounded text-sm">@Controller</code>的元注解</li>
                        </ul>
                    </div>
                    <div class="code-block p-4 mb-4">
                        <pre class="text-sm text-gray-800"><code>@Component
public class UserService {
    // 业务逻辑
}</code></pre>
                    </div>
                </div>
            </div>
            
            <!-- @Configuration -->
            <div class="mb-12">
                <div class="flex items-center mb-4">
                    <span class="bg-green-600 text-white text-lg font-bold px-4 py-2 rounded-full mr-4">3</span>
                    <h3 class="text-2xl font-bold text-gray-800">@Configuration 注解</h3>
                </div>
                <div class="pl-16">
                    <p class="text-gray-700 mb-4">
                        <code class="bg-gray-100 px-2 py-1 rounded text-pink-600">@Configuration</code>表示一个类是配置类，用于声明Bean的创建和其他配置。
                    </p>
                    <div class="bg-gray-50 p-4 rounded-lg border-l-4 border-green-500 mb-4">
                        <h4 class="font-bold text-gray-800 mb-2 flex items-center">
                            <i class="fas fa-info-circle text-green-500 mr-2"></i>关键特性
                        </h4>
                        <ul class="list-disc pl-5 text-gray-700 space-y-2">
                            <li>类级别的注解</li>
                            <li>类似于XML配置文件的替代方案</li>
                            <li>通常与<code class="bg-gray-100 px-1 py-0.5 rounded text-sm">@Bean</code>一起使用</li>
                            <li>方法间调用会返回容器中的Bean实例</li>
                        </ul>
                    </div>
                    <div class="code-block p-4 mb-4">
                        <pre class="text-sm text-gray-800"><code>@Configuration
public class AppConfig {
    
    @Bean
    public UserService userService() {
        return new UserServiceImpl();
    }
    
    @Bean
    public OrderService orderService() {
        return new OrderServiceImpl(userService());
    }
}</code></pre>
                    </div>
                </div>
            </div>
        </section>

        <!-- Comparison Section -->
        <section class="mb-16">
            <h2 class="heading-serif text-3xl font-bold mb-8 border-b pb-2">核心区别对比</h2>
            
            <div class="overflow-x-auto">
                <table class="comparison-table w-full bg-white rounded-lg overflow-hidden shadow">
                    <thead>
                        <tr class="text-left">
                            <th class="px-6 py-3 border-b-2 border-gray-200 font-bold text-gray-700">特性</th>
                            <th class="px-6 py-3 border-b-2 border-gray-200 font-bold text-gray-700">@Bean</th>
                            <th class="px-6 py-3 border-b-2 border-gray-200 font-bold text-gray-700">@Component</th>
                            <th class="px-6 py-3 border-b-2 border-gray-200 font-bold text-gray-700">@Configuration</th>
                        </tr>
                    </thead>
                    <tbody>
                        <tr>
                            <td class="px-6 py-4 border-b border-gray-200 font-medium">注解级别</td>
                            <td class="px-6 py-4 border-b border-gray-200">方法级别</td>
                            <td class="px-6 py-4 border-b border-gray-200">类级别</td>
                            <td class="px-6 py-4 border-b border-gray-200">类级别</td>
                        </tr>
                        <tr>
                            <td class="px-6 py-4 border-b border-gray-200 font-medium">生命周期管理</td>
                            <td class="px-6 py-4 border-b border-gray-200">开发者控制</td>
                            <td class="px-6 py-4 border-b border-gray-200">容器管理</td>
                            <td class="px-6 py-4 border-b border-gray-200">容器管理</td>
                        </tr>
                        <tr>
                            <td class="px-6 py-4 border-b border-gray-200 font-medium">实例化方式</td>
                            <td class="px-6 py-4 border-b border-gray-200">显式创建</td>
                            <td class="px-6 py-4 border-b border-gray-200">自动实例化</td>
                            <td class="px-6 py-4 border-b border-gray-200">结合@Bean使用</td>
                        </tr>
                        <tr>
                            <td class="px-6 py-4 border-b border-gray-200 font-medium">主要用途</td>
                            <td class="px-6 py-4 border-b border-gray-200">第三方库集成</td>
                            <td class="px-6 py-4 border-b border-gray-200">业务组件</td>
                            <td class="px-6 py-4 border-b border-gray-200">配置声明</td>
                        </tr>
                        <tr>
                            <td class="px-6 py-4 font-medium">方法间调用</td>
                            <td class="px-6 py-4">-</td>
                            <td class="px-6 py-4">创建新实例</td>
                            <td class="px-6 py-4">返回容器实例</td>
                        </tr>
                    </tbody>
                </table>
            </div>
        </section>

        <!-- Visualization -->
        <section class="mb-16">
            <h2 class="heading-serif text-3xl font-bold mb-8 border-b pb-2">注解关系图解</h2>
            <div class="mermaid">
                classDiagram
                    class Bean {
                        +方法级别注解
                        +开发者控制实例化
                        +第三方库集成
                    }
                    
                    class Component {
                        +类级别注解
                        +容器管理生命周期
                        +自动扫描注册
                    }
                    
                    class Configuration {
                        +类级别注解
                        +配置类定义
                        +方法间调用返回容器实例
                    }
                    
                    Component <|-- Service
                    Component <|-- Repository
                    Component <|-- Controller
                    
                    Configuration "1" *-- "*" Bean : 包含
                    
                    note for Bean "用于显式声明Bean的创建过程\n适用于需要自定义实例化逻辑的场景"
                    note for Component "通用组件注解\n是@Service,@Repository等的元注解"
                    note for Configuration "替代XML配置的方式\n定义应用的整体配置"
            </div>
        </section>

        <!-- Code Example Section -->
        <section class="mb-16">
            <h2 class="heading-serif text-3xl font-bold mb-8 border-b pb-2">关键区别示例</h2>
            
            <div class="bg-white rounded-xl shadow-md overflow-hidden mb-8">
                <div class="bg-gray-800 text-white px-6 py-3 flex items-center">
                    <i class="fas fa-code mr-2"></i>
                    <span class="font-mono">BeanConfig.java</span>
                </div>
                <div class="code-block p-4">
                    <pre class="text-sm text-gray-800"><code>// @Configuration 
@Component
public class BeanConfig {

    @Bean
    public User user1() {
        User user = new User();
        System.out.println("BeanConfig.user1:" + user);
        return user;
    }

    @Bean
    public String testUser() {
        // @Configuration 每次调用user1()返回的都是容器中的对象
        // @Component 每次调用user1()都会创建一个新的对象
        User user = user1();
        System.out.println(user); 
        return "hello";
    }
}</code></pre>
                </div>
            </div>
            
            <div class="grid md:grid-cols-2 gap-8">
                <div class="bg-blue-50 p-6 rounded-lg border-l-4 border-blue-500">
                    <h3 class="font-bold text-xl mb-3 text-blue-800 flex items-center">
                        <i class="fas fa-check-circle mr-2"></i>使用@Configuration时
                    </h3>
                    <ul class="list-disc pl-5 text-gray-700 space-y-2">
                        <li><code>user1()</code>方法只会被调用一次</li>
                        <li><code>testUser()</code>中调用<code>user1()</code>会返回容器中已有的实例</li>
                        <li>保证单例行为</li>
                    </ul>
                </div>
                <div class="bg-purple-50 p-6 rounded-lg border-l-4 border-purple-500">
                    <h3 class="font-bold text-xl mb-3 text-purple-800 flex items-center">
                        <i class="fas fa-exclamation-circle mr-2"></i>使用@Component时
                    </h3>
                    <ul class="list-disc pl-5 text-gray-700 space-y-2">
                        <li>每次调用<code>user1()</code>都会创建一个新实例</li>
                        <li>不会维护单例行为</li>
                        <li>可能导致意外的对象创建</li>
                    </ul>
                </div>
            </div>
        </section>

        <!-- Best Practices -->
        <section class="mb-16 bg-indigo-50 p-8 rounded-xl">
            <h2 class="heading-serif text-3xl font-bold mb-6 text-indigo-800">最佳实践建议</h2>
            
            <div class="grid md:grid-cols-2 gap-6">
                <div class="flex items-start">
                    <div class="bg-indigo-100 text-indigo-600 p-3 rounded-full mr-4">
                        <i class="fas fa-lightbulb"></i>
                    </div>
                    <div>
                        <h3 class="font-bold text-lg mb-2">何时使用@Bean</h3>
                        <p class="text-gray-700">需要显式控制Bean创建逻辑时，特别是集成第三方库或需要复杂初始化过程的场景。</p>
                    </div>
                </div>
                <div class="flex items-start">
                    <div class="bg-indigo-100 text-indigo-600 p-3 rounded-full mr-4">
                        <i class="fas fa-lightbulb"></i>
                    </div>
                    <div>
                        <h3 class="font-bold text-lg mb-2">何时使用@Component</h3>
                        <p class="text-gray-700">开发业务组件时，特别是服务层、数据访问层和控制器层的类。</p>
                    </div>
                </div>
                <div class="flex items-start">
                    <div class="bg-indigo-100 text-indigo-600 p-3 rounded-full mr-4">
                        <i class="fas fa-lightbulb"></i>
                    </div>
                    <div>
                        <h3 class="font-bold text-lg mb-2">何时使用@Configuration</h3>
                        <p class="text-gray-700">定义应用配置时，特别是需要声明多个相关Bean或需要方法间引用Bean的场景。</p>
                    </div>
                </div>
                <div class="flex items-start">
                    <div class="bg-indigo-100 text-indigo-600 p-3 rounded-full mr-4">
                        <i class="fas fa-lightbulb"></i>
                    </div>
                    <div>
                        <h3 class="font-bold text-lg mb-2">避免的常见错误</h3>
                        <p class="text-gray-700">不要在@Component类中通过方法调用创建Bean，这会导致意外的对象创建。应该使用@Configuration类。</p>
                    </div>
                </div>
            </div>
        </section>
    </main>

    <!-- Footer -->
    <footer class="footer text-white py-8">
        <div class="container mx-auto max-w-5xl px-4 md:px-0">
            <div class="flex flex-col md:flex-row justify-between items-center">
                <div class="mb-4 md:mb-0">
                    <h3 class="text-xl font-bold">技术小馆</h3>
                    <p class="text-gray-400 mt-1">深入探索技术世界的奥秘</p>
                </div>
                <div>
                    <a href="http://www.yuque.com/jtostring" class="text-gray-300 hover:text-white transition-colors duration-300 inline-flex items-center">
                        <i class="fas fa-external-link-alt mr-2"></i>
                        访问技术小馆语雀
                    </a>
                </div>
            </div>
        </div>
    </footer>

    <script>
        mermaid.initialize({
            startOnLoad: true,
            theme: 'default',
            fontFamily: "'Noto Sans SC', sans-serif",
            flowchart: {
                useMaxWidth: false,
                htmlLabels: true
            }
        });
    </script>
</body>
</html>
```